<template>
  <div class="app-container">
    <div class="filter-container">
      <el-input
       :disabled="userState"
        v-model="queryParams.lockMac"
        placeholder="设备编号"
        style="width: 200px"
        class="filter-item"
        @keyup.enter.native="queryBtn"
      />

      <el-input
       :disabled="userState"
        v-model="queryParams.lockAddress"
        placeholder="泊位名称"
        style="width: 200px;margin-left: 5px;"
        class="filter-item"
        @keyup.enter.native="queryBtn"
      />

      <!-- <el-input
        v-model="queryParams.parkfieldName"
        placeholder="泊位地址"
        style="width: 200px;margin-left: 5px;"
        class="filter-item"
        @keyup.enter.native="handleFilter"
      /> -->

      <!-- <el-select
        v-model="listQuery.phone"
        placeholder="号码"
        clearable
        style="width: 90px"
        class="filter-item"
      >
        <el-option
          v-for="item in importanceOptions"
          :key="item"
          :label="item"
          :value="item"
        />
      </el-select>
      <el-select
        v-model="listQuery.number"
        placeholder="数字"
        clearable
        class="filter-item"
        style="width: 130px"
      >
        <el-option
          v-for="item in calendarTypeOptions"
          :key="item.key"
          :label="item.display_name + '(' + item.key + ')'"
          :value="item.key"
        />
      </el-select> -->

      <el-button
       :disabled="userState"
        v-waves
        class="filter-item"
        type="primary"
        icon="el-icon-search"
        style="margin-left: 5px;"
        @click="queryBtn"
      >
        查询
      </el-button>
      <!-- <el-button
        class="filter-item"
        style="margin-left: 10px"
        type="primary"
        icon="el-icon-edit"
        @click="handleCreate"
      >
        添加
      </el-button> -->
      <!--  <el-button v-waves :loading="downloadLoading" class="filter-item" type="primary" icon="el-icon-download" @click="handleDownload">
        导出
      </el-button>  -->
      <span style="float: right;
    margin-right: 20px;
    font-weight: 600;color: #494949;">当前账号：<span style="color: #ff770f;">{{title}}</span></span>
  
    </div>

    <el-table
      :header-cell-style="{ background: '#ffffff', color: '#000000' }"
      :key="tableKey"
      :row-class-name="tableRowClassName"
      v-loading="listLoading"
      :data="list"
      border
      fit
      highlight-current-row
      style="
        width: 100%;
        font-size: 15px;
        box-shadow: 1px 1px 8px #cdcdcd;
        border: 0px;
      "
      @sort-change="sortChange"
    >
      <!-- <el-table-column label="逻辑编号" prop="id" sortable="custom" align="center" width="80" :class-name="getSortClass('id')"> -->
      <el-table-column
        label="逻辑编号"
        prop="id"
        sortable="custom"
        align="center"
        width="150"
        :class-name="getSortClass('id')"
      >
        <template slot-scope="{ row }">
          <span>{{ row.lockMac }}</span>
        </template>
      </el-table-column>

      <el-table-column label="泊位名称" min-width="120px">
        <template slot-scope="{ row }">
          <span>{{ row.lockAddress }}</span>
        </template>
      </el-table-column>

      <!-- <el-table-column label="所属场站" min-width="250px">
        <template slot-scope="{ row }">
          <span>{{ row.parkfieldName }}</span>
        </template>
      </el-table-column> -->

      <el-table-column label="泊位地址" min-width="200px">
        <template slot-scope="{ row }">
          <span>{{ row.batteryAddress }}</span>
        </template>
      </el-table-column>



      <el-table-column label="泊位类型" min-width="80px">
        <template slot-scope="{ row }">
          <!-- <span>{{ row.lockType }}</span> -->
 
          <el-tag
            v-if="row.lockType == '纯充电桩'"
            size="medium"
            type="success"
            effect="dark"
            style="font-size: 14px"
            >纯充电桩</el-tag
          >
          <el-tag
            v-else-if="row.lockType == '扫码充电'"
            size="medium"
            type="warning"
            effect="dark"
            style="font-size: 14px"
            >扫码充电</el-tag>
          <el-tag v-else size="medium" type="Info" style="font-size: 14px">{{
            row.lockType
          }}</el-tag>
                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

          <el-button :disabled="userState" type="primary" size="mini" @click="batchChangeType(row)">
            
            <i class="el-icon-edit"></i>
          </el-button>

        </template>
      </el-table-column>



      <el-table-column
        label="启停"
        align="center"
        width="180"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="{ row }">

          <el-button
          :disabled="userState"
            v-if="row.lockStatus === '空闲中'"
            size="mini"
            type="danger"
            @click="updateStatus(row)"
            >停止</el-button>
            
          <el-button
          :disabled="userState"
            v-if="row.lockStatus === '调试中'"
            size="mini"
            type="primary"
            @click="updateStatus(row)"
            >离线/启用</el-button>

            <el-button
          :disabled="userState"
            v-if="row.lockStatus === '人工停止中'"
            size="mini"
            type="primary"
            @click="updateStatus(row)"
            >人工停止/启用</el-button>

          <el-button
          :disabled="userState"
            v-if="row.lockStatus === '使用中'"
            size="mini"
            type="danger"
            @click="updateStatus(row)"
            >停止</el-button>

          <el-button
          :disabled="userState"
            v-if="row.lockStatus === '预约中'"
            size="mini"
            type="danger"
            @click="updateStatus(row)"
            >停止</el-button>

        </template>
      </el-table-column>



      <el-table-column label="泊控器状态" width="180px" align="center">
        <template slot-scope="{ row }">
          <el-tag
            v-if="row.lockStatus == '空闲中'"
            size="medium"
            type="success"
            effect="dark"
            style="font-size: 14px"
            >空闲中</el-tag
          >
          <el-tag
            v-else-if="row.lockStatus == '使用中'"
            size="medium"
            type="warning"
            effect="dark"
            style="font-size: 14px"
            >使用中</el-tag
          >
           <el-tag
            v-else-if="row.lockStatus == '预约中'"
            size="medium"
            type="primary"
            effect="dark"
            style="font-size: 14px"
            >预约中</el-tag
          >
          <el-tag v-else size="medium" type="Info" style="font-size: 14px">{{
            row.lockStatus
          }}</el-tag>
        </template>
      </el-table-column>

      <el-table-column label="创建日期" width="150px">
        <template slot-scope="{ row }">
          <span>{{ row.createDate.substring(0, 10) }}</span>
        </template>
      </el-table-column>


      <el-table-column
        label="电价配置"
        align="center"
        width="100"
        class-name="small-padding fixed-width">
        <template slot-scope="{ row }">
          <el-button :disabled="userState" type="primary" size="mini" @click="handleUpdate(row)">
            <i class="el-icon-edit"></i>
            配置
          </el-button>
        </template>
      </el-table-column>

      <el-table-column
        label="参数配置"
        align="center"
        width="100"
        class-name="small-padding fixed-width">
        <template slot-scope="{ row }">
          <el-button :disabled="userState" type="warning" size="mini" @click="getParam(row)">
            <i class="el-icon-edit"></i>
            配置
          </el-button>
        </template>
      </el-table-column>


    </el-table>

    <el-row>
      <el-col :span="24" class="page-tool">
        <el-pagination
          layout="total,sizes,prev, pager,next,jumper"
           style="margin-top: 10px;"
          :page-size="pageSize"
          :total="total"
          :page-sizes="[10, 20, 30, 40]"
          @size-change="handlePageChange"
          @current-change="handleNoChange"
        ></el-pagination>
      </el-col>
    </el-row>


    <el-dialog title="修改泊位状态" :visible.sync="changeTypeDialog" :width="'422px'">
      <el-form :model="formType" ref="formType">
        <el-form-item :label="dialogLable" :label-width="labelWidth" prop="">
          <!-- <el-select v-model="formType.selected" clearable :placeholder="dialogPlaceholder"> -->
            <!-- <el-option v-for="(value, key) in typeAstatus" v-bind:key="key" :label="value" :value="key"></el-option> -->
            <!-- <el-option key="0" label="扫码充电" :value="扫码充电"></el-option>
            <el-option key="1" label="纯充电桩" :value="纯充电桩"></el-option>
          </el-select> -->

          <el-select v-model="formType.selected" placeholder="请选状态">
            <el-option key="0" label="扫码充电" :value="2"></el-option>
            <el-option key="1" label="纯充电桩" :value="1"></el-option>
          </el-select>



        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="changeTypeDialog = false">取 消</el-button>
        <el-button type="primary" @click="batchBtn">确 定</el-button>
      </div>
    </el-dialog>

    <el-dialog title="修改参数" :visible.sync="editParamDialog" :width="'422px'">
      <el-form :model="formParam" ref="formParam">
         
        <el-form-item label="通讯模块编号" :label-width="labelWidth" prop="unicode">
          <el-input v-model="formParam.unicode"  auto-complete="off" style="width:180px"></el-input> 
        </el-form-item>
 
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="editParamDialog = false">取 消</el-button>
        <el-button type="primary" @click="setParam">确 定</el-button>
      </div>
    </el-dialog>
    

      <el-dialog title="修改价格" :visible.sync="editFeeDialog" :width="'850px'" :destroy-on-close="true">
      <el-form :model="feeForm" :rules="feeRules" ref="feeForm">
        <el-form-item label="挪车时间" :label-width="labelWidth" prop="freeTime">
          <el-input-number v-model="feeForm.freeTime" :min="30" :step="30"></el-input-number> 分钟
        </el-form-item>
       <el-form-item label="占位费" :label-width="labelWidth">
          <el-col :span="4">
        <el-form-item prop="occupiedFee">
          <el-input v-model="feeForm.occupiedFee" auto-complete="off" style="width:80px"></el-input> 元 /
        </el-form-item>
          </el-col>
          <el-col :span="6">
        <el-form-item prop="occupiedUnit">
          <el-input v-model="feeForm.occupiedUnit" auto-complete="off" style="width:80px"></el-input> 分钟
        </el-form-item>
          </el-col>
          <el-col :span="6">
          <el-button type="primary" @click="OpenDetail">详情</el-button>
        </el-col>
        </el-form-item>
       
        


<el-form-item :label-width="'20px'" v-if="timeSharing" required>
        <el-col :span="8">
        <el-form-item label="基础电价(尖)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input @input="addPrice11" v-model="feeForm.electric1" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
      </el-col>
        <el-col :span="8">
         <el-form-item label="服务费(尖)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input @input="addPrice12" v-model="feeForm.serviceFee1" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
        </el-col>
        <el-col :span="8">
         <el-form-item label="收费总价(尖)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input disabled v-model="feeForm.electricFee1" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
        </el-col>
  </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
        <el-col :span="8">
        <el-form-item label="基础电价(峰)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input @input="addPrice21" v-model="feeForm.electric2" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
      </el-col>
        <el-col :span="8">
         <el-form-item label="服务费(峰)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input @input="addPrice22" v-model="feeForm.serviceFee2" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
        </el-col>
        <el-col :span="8">
         <el-form-item label="收费总价(峰)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input disabled v-model="feeForm.electricFee2" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
        </el-col>
  </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
        <el-col :span="8">
        <el-form-item label="基础电价(平)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input @input="addPrice31" v-model="feeForm.electric3" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
      </el-col>
        <el-col :span="8">
         <el-form-item label="服务费(平)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input @input="addPrice32" v-model="feeForm.serviceFee3" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
        </el-col>
        <el-col :span="8">
         <el-form-item label="收费总价(平)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input disabled v-model="feeForm.electricFee3" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
        </el-col>
  </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
        <el-col :span="8">
        <el-form-item label="基础电价(谷)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input @input="addPrice41" v-model="feeForm.electric4" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
      </el-col>
        <el-col :span="8">
         <el-form-item label="服务费(谷)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input @input="addPrice42" v-model="feeForm.serviceFee4" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
        </el-col>
        <el-col :span="8">
         <el-form-item label="收费总价(谷)" :label-width="labelWidth" v-if="timeSharing" prop="">
          <el-input disabled v-model="feeForm.electricFee4" auto-complete="off" style="width:100px"></el-input> 元
        </el-form-item>
        </el-col>
  </el-form-item>

  

        <el-form-item label="执行电价" :label-width="labelWidth" v-if="!timeSharing" prop="electricFee">
          <el-input v-model="feeForm.electricFee" auto-complete="off" style="width:200px"></el-input> 元
        </el-form-item>

   <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime1" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime2" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select :label-width="labelWidth2" ref="select" v-model="electric.electric1" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime2" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime3" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric2" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime3" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime4" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric3" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime4" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime5" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric4" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>

     <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime5" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime6" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric5" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime6" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime7" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric6" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime7" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime8" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric7" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime8" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime9" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric8" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime9" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime10" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric9" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime10" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime11" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric10" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>


  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime11" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime12" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric11" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime12" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime13" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric12" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime13" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime14" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric13" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime14" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime15" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric14" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime15" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime16" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric15" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime16" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime17" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric16" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime17" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime18" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric17" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime18" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime19" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric18" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime19" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime20" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric19" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime20" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime21" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric20" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime21" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime22" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric21" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime22" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime23" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric22" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>

  <el-form-item :label-width="'20px'" v-if="timeSharing" required>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime23" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime24" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric23" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   <el-col :span="3.8"><el-form-item><el-time-select v-model="feeForm.startTime24" disabled style="width:100px;color:black;"></el-time-select> -</el-form-item></el-col>
   <el-col :span="3.9"><el-form-item prop=""><el-time-select placeholder="结束时间" v-model="feeForm.startTime25" disabled style="width:100px;margin-left:4px;"></el-time-select></el-form-item></el-col>
   <el-col :span="5"><el-select ref="select" v-model="electric.electric24" placeholder="请选择" style="width:130px;margin-left:4px;"><el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-col>
   </el-form-item>


        <el-form-item label="分时设置" prop="timeSharing" :label-width="labelWidth" style="margin-left:550px;">
          <el-switch v-model="timeSharing" @change="timeSharingChange"></el-switch>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="editFeeDialog = false" >取 消</el-button>
        <el-button type="primary" @click="batchChangePriceSubmit">确 定</el-button>
      </div>
    </el-dialog>

    <el-dialog title="分时电价详情" :visible.sync="detailDialog" :width="'422px'">
      <el-form v-show="totalPrice" :model="formType" ref="formType">
        <el-form-item label="全时段统一价" :label-width="labelWidth" prop="">
          <el-input disabled v-model="feeForm.electricFee1" auto-complete="off" style="width:80px"></el-input> 元 / 度
        </el-form-item>
      </el-form>
      <el-form v-show="totalPrice2" :model="formType" ref="formType">
        <el-form-item :label="feeForm.interval1" :label-width="labelWidth" prop="">
          <el-input disabled v-model="feeForm.electricFee1" auto-complete="off" style="width:80px"></el-input> 元 / 度
        </el-form-item>
        <el-form-item :label="feeForm.interval2" :label-width="labelWidth" prop="">
         <el-input disabled v-model="feeForm.electricFee2" auto-complete="off" style="width:80px"></el-input> 元 / 度
        </el-form-item>
        <el-form-item :label="feeForm.interval3" :label-width="labelWidth" prop="">
          <el-input disabled v-model="feeForm.electricFee3" auto-complete="off" style="width:80px"></el-input> 元 / 度
        </el-form-item>
        <el-form-item :label="feeForm.interval4" :label-width="labelWidth" prop="">
          <el-input disabled v-model="feeForm.electricFee4" auto-complete="off" style="width:80px"></el-input> 元 / 度
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="detailDialog = false">关闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<style>

.page-tool div {
  text-align: right;
}

.lock-btn {
  margin-bottom: 5px;
  margin-top: -10px;
}
.operateBtn {
  font-size: 18px;
  width: 32px;
  height: 32px;
  padding: 0;
}


.el-table .warning-row {
  background: #fff5ee;
}
.el-table--enable-row-hover .el-table__body tr:hover > td {
  background-color: #fdc091;
}
.el-table__body tr.current-row > td {
  background-color: #fdc091;
}
</style>

<script>
import {
  listCar,
  deleteCar,
  addCar,
  updateCar,
  exportcar,
  getlclock,
} from "@/api/car";
import waves from "@/directive/waves"; // waves directive
import { parseTime } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import axios from "axios";
import { getToken } from "@/utils/auth";
import { listLock } from "@/api/lock";
import service from "@/utils/request";
import { loadlockApi, batchChange,batchChange2} from "@/api/car";
import { getPriceBylockApi,setPriceBylockApi,setParamBylockApi} from "@/api/Price";
import { getNickName, getTestUserName } from "../../utils/auth";



const calendarTypeOptions = [
  { key: "CN", display_name: "China" },
  { key: "US", display_name: "USA" },
  { key: "JP", display_name: "Japan" },
  { key: "EU", display_name: "Eurozone" },
];

// arr to obj, such as { CN : "China", US : "USA" }
const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
  acc[cur.key] = cur.display_name;
  return acc;
}, {});

export default {
  name: "ComplexTable",
  components: { Pagination },
  directives: { waves },
  filters: {
    statusFilter(status) {
      const statusMap = {
        published: "success",
        draft: "info",
        deleted: "danger",
      };
      return statusMap[status];
    },
    typeFilter(type) {
      return calendarTypeKeyValue[type];
    },
  },
  data() {
    return {
      tableKey: 0,
      // pageNo2:'1',
      // pageSize2:'10000',
      list: [],
      //   total: 20,
      listLoading: true,
      formType:{},
      formParam:{
        unicode:"",
        id:"",
      },
      select:'',
      multipleSelection: [],
      queryParams: {
        lockMac: "",
        lockAddress: "",
      },
      detailDialog:false,
      lockId:'',
      changeTypeDialog: false,
      dialogLable: "泊位状态",
      dialogPlaceholder: "",
      totalPrice:false,
      totalPrice2:false,
      typeAstatus:[
        '纯充电桩', 
        '扫码充电'
      ],
      typeAstatus: [
        { value: 2, label: '纯充电桩' },
        { value: 0, label: '扫码充电' } 
      ],
       feeRules: {
        
        freeTime: [
            { required: true, message: '请选择免费时间', trigger: 'blur' }
          ],
        occupiedFee: [
            { required: true, message: '请输入占位费', trigger: 'blur' }
          ],
         occupiedUnit: [
            { required: true, message: '请输入占位费时间', trigger: 'blur' }
          ],
        electricFee: [
            { required: true, message: '请输入执行电价', trigger: 'blur' }
          ],
        startTime1: [
            { required: true, message: '请选择起始时间', trigger: 'blur' }
          ],
        endTime1: [
            { required: true, message: '请选择结束时间', trigger: 'blur' }
          ],
        electricFee1: [
            { required: true, message: '请设置收费价格(尖)', trigger: 'blur' },
            { pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/, message: '请输入正确价格' },
          ],
        startTime2: [
            { required: true, message: '请选择起始时间', trigger: 'blur' }
          ],
        endTime2: [
            { required: true, message: '请选择结束时间', trigger: 'blur' }
          ],
        electricFee2: [
            { required: true, message: '请设置收费价格(峰)', trigger: 'blur' },
            { pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/, message: '请输入正确价格' },
          ],
        startTime3: [
            { required: true, message: '请选择起始时间', trigger: 'blur' }
          ],
        endTime3: [
            { required: true, message: '请选择结束时间', trigger: 'blur' }
          ],
        electricFee3: [
            { required: true, message: '请设置收费价格(平)', trigger: 'blur' },
            { pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/, message: '请输入正确价格' },
          ],
        startTime4: [
            { required: true, message: '请选择起始时间', trigger: 'blur' }
          ],
        endTime4: [
            { required: true, message: '请选择结束时间', trigger: 'blur' }
          ],
        electricFee4: [
            { required: true, message: '请设置收费价格(谷)', trigger: 'blur' },
            { pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/, message: '请输入正确价格' }
          ],
      },
      labelWidth:'120px',
      editFeeDialog: false,
      editParamDialog: false,
      unicode:'',
      electric: {
      electric1:"2",
      electric2:"2",
      electric3:"2",
      electric4:"2",
      electric5:"2",
      electric6:"2",
      electric7:"2",
      electric8:"2",
      electric9:"2",
      electric10:"2",
      electric11:"2",
      electric12:"2",
      electric13:"2",
      electric14:"2",
      electric15:"2",
      electric16:"2",
      electric17:"2",
      electric18:"2",
      electric19:"2",
      electric20:"2",
      electric21:"2",
      electric22:"2",
      electric23:"2",
      electric24:"2"
      },
      electricList:[],
      electricList2:[],
      feeForm: {
        freeTime: 0,
        occupiedUnit:"",
        occupiedFee: "",
        electricFee: "",
        oriFee: "",
        serviceFee: "",
        startTime1: "00:00",
        startTime2: "01:00",
        startTime3: "02:00",
        startTime4: "03:00",
        startTime5: "04:00",
        startTime6: "05:00",
        startTime7: "06:00",
        startTime8: "07:00",
        startTime9: "08:00",
        startTime10: "09:00",
        startTime11: "10:00",
        startTime12: "11:00",
        startTime13: "12:00",
        startTime14: "13:00",
        startTime15: "14:00",
        startTime16: "15:00",
        startTime17: "16:00",
        startTime18: "17:00",
        startTime19: "18:00",
        startTime20: "19:00",
        startTime21: "20:00",
        startTime22: "21:00",
        startTime23: "22:00",
        startTime24: "23:00",
        startTime25: "24:00",
        electricFee1: "255",
        electricFee2: "255",
        electricFee3: "255",
        electricFee4: "255",
        electricFee_selected: ""
      },
      labelWidth2:'10px',
      options: [
        { value: '0', label: '尖' },
        { value: '1', label: '峰' },
        { value: '2', label: '平' },
        { value: '3', label: '谷' }
      ],
      remark:"",
      timeSharing: true,
      listQuery: {
        pageNo: 1,
        pageSize: 20,
        name: undefined,
        phone: undefined,
        number: undefined,
        sort: "+id",
      },
      key:"",
      currentPage: 1, // 右边 当前批次分页
      total: 0, // 右边 批次分页个数
      pageNo: 1,
      pageSize: 20,
      title:"",
      listQuery2: {
        pageNo: 1,
        pageSize: 20,
      },
      title:"",
      importanceOptions: [1, 2, 3],
      calendarTypeOptions,
      sortOptions: [
        { label: "ID Ascending", key: "+id" },
        { label: "ID Descending", key: "-id" },
      ],
      statusOptions: ["published", "draft", "deleted"],
      showReviewer: false,
      loading:false,
      temp: {
        id: undefined,
        importance: 1,
        remark: "",
        timestamp: new Date(),
        title: "",
        type: "",
        status: "published",
      },
      dialogFormVisible: false,
      dialogStatus: "",
      textMap: {
        update: "Edit",
        create: "Create",
      },
      dialogPvVisible: false,
      pvData: [],
      rules: {
        type: [
          { required: true, message: "type is required", trigger: "change" },
        ],
        timestamp: [
          {
            type: "date",
            required: true,
            message: "timestamp is required",
            trigger: "change",
          },
        ],
        title: [
          { required: true, message: "title is required", trigger: "blur" },
        ],
      },
      downloadLoading: false,
    };
  },
  created() {
    // this.getList();
    // console.log("123456789");
  },
  computed: {
    userState() {
      return getNickName() === getTestUserName();
    },
  },
  mounted: function () {
    this.key = localStorage.getItem("key");
    this.title = localStorage.getItem("title");
    this.$nextTick(function () {
      this.loadlock(this.pageNo, this.pageSize);
    });
  },
  methods: {
    //     handleSizeChange(val) {
    //     this.pageSize1 = val;
    //     this.fetchRightData(this.selectProduct, this.order, this.order_by);
    // },
    // handleCurrentChange(val) {
    //     this.currentPage1 = val;
    //     this.fetchRightData(this.selectProduct, this.order, this.order_by);
    // },
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 == 0) {
        return "warning-row";
      }
      return "";
    },

    OpenDetail(){
      var _this = this;
      _this.detailDialog = true;
     
   if(_this.feeForm.electricFee1 != _this.feeForm.electricFee2 || _this.feeForm.electricFee2 != _this.feeForm.electricFee3 || _this.feeForm.electricFee3 != _this.feeForm.electricFee4){
      _this.totalPrice = false
      _this.totalPrice2 = true
    }else{
      _this.totalPrice = true
      _this.totalPrice2 = false
    }

    },

    batchBtn(row){

      var _this= this;
      // _this.multipleSelection[0] = row;
      if (_this.formType.selected == null || _this.formType.selected == "") {
            return;
       }

      // _this.multipleSelection[0] = row;
 
      // let status = row.lockStatus == '使用中' ? '使用中': '空闲中';
      // let type = row.lockType == "扫码充电" ? 0 : 2;
      // status = status.toString();

      if(_this.formType.selected == '1'){
        _this.select = 2
      }else if(_this.formType.selected == '2'){
        _this.select = 0
      }

      

      console.log("111111111111111111111");
      batchChange2(_this.lockId, null,_this.select, null).then(function (resp) {
        if (resp.errmsg === "ok") {
          _this.loadlock(_this.pageNo, _this.pageSize);
          _this.$notify({
            title: "成功",
            message: "操作成功",
            type: "success",
          });
        } else {
          _this.$notify({
            title: "失败",
            message: "操作失败，请稍后重试。",
            type: "error",
          });
        }

      });
      this.changeTypeDialog=false;

    },

    timeSharingChange () {
    
    },
    //列表页码的触发事件

    batchChangeType(row) {
      var _this=this;
      _this.lockId="";
      this.changeTypeDialog=true;

      // _this.formType.selected=row.lockType;
      
      _this.lockId=row.lockId;
      console.log(row);
      formType.selected='';
      
      
    },

    updateStatus(row) {
      let _this = this;
      _this.multipleSelection[0] = row;
 
      // let status = row.lockStatus == '使用中' ? '使用中': '空闲中';
      let status = row.lockStatus == "调试中" ||  row.lockStatus == "人工停止中"? 2 : 99;

      
      // status = status.toString();
      batchChange(_this.multipleSelection, status, null, null).then(function (
        resp
      ) {
        if (resp.errmsg === "ok") {
          _this.loadlock(_this.pageNo, _this.pageSize);
          _this.$notify({
            title: "成功",
            message: "操作成功",
            type: "success",
          });
        } else {
          _this.$notify({
            title: "失败",
            message: "操作失败，请稍后重试。",
            type: "error",
          });
        }
      });
    },
    handlePageChange(pageSize) {
      this.pageSize = pageSize;
      this.loadlock(this.pageNo, this.pageSize);
    },
    handleNoChange(pageNo) {
      this.pageNo = pageNo;
      this.loadlock(this.pageNo, this.pageSize);
    },
    handleTableChange(val) {
      this.multipleSelection = val;
    },
    loadlock(pageNo, pageSize) {
      let _this = this;
      _this.loading = true;
      loadlockApi({
        pageNo: pageNo,
        pageSize: pageSize,
        lockMac: _this.queryParams.lockMac,
        lockAddress: _this.queryParams.lockAddress,
        roleCode:_this.key
      }).then((response) => {
        _this.list = response.data.dataList;
        _this.total = response.data.totalNum;
        setTimeout(() => {
          _this.listLoading = false;
        }, 1 * 1000);
      });
    },

    queryBtn() {
      let _this = this;
      _this.loading = true;

      this.loadlock(_this.pageNo, _this.pageSize);
    },
    //////////////////////////

    // getList() {
    //   this.listLoading = true;
    //   // axios
    //   //   .get("/lclock?pageNo=1&pageSize=20&sort=%2Bid", {
    //   //     headers: {
    //   //       pacargle:getToken()
    //   //         // "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2NTM0NzE3ODgsImV4cCI6MTY1MzQ3ODk4OCwibWFuZ2VySWQiOjEsIm5pY2tOYW1lIjoi6LaF57qn566h55CG5ZGYIiwicm9sZUlkIjoxLCJyZWZyZXNoQ291bnQiOjAsImxvZ2luTmFtZSI6ImFkbWluIn0.zGjWKwBIQOYQqor3sTjyA7mA-arOH3ZwRwq4jsb4WNA",
    //   //     },
    //   //   })
    //   getlclock("1", "20")
    //     .then((response) => {
    //       console.log("1");
    //       console.log(
    //         response,
    //         "response==============>这是我打印出来的数据===>===>==设备管理==="
    //       );
    //       console.log(response.data.dataList, "数据列表======");
    //       console.log(response.data.totalNum, "数据列表======");
    //       this.list = response.data.dataList;
    //       this.total = response.data.totalNum;

    //       setTimeout(() => {
    //         this.listLoading = false;
    //       }, 1.5 * 1000);
    //     })
    //     .catch((err) => console.log(err));
    // },
    handleFilter() {
      this.listQuery.pageNo = 1;
   //   this.getList();
    },
    handleModifyStatus(row, status) {
      this.$message({
        message: "操作Success",
        type: "success",
      });
      row.status = status;
    },
    sortChange(data) {
      const { prop, order } = data;
      if (prop === "id") {
        this.sortByID(order);
      }
    },
    sortByID(order) {
      if (order === "ascending") {
        this.listQuery.sort = "+id";
      } else {
        this.listQuery.sort = "-id";
      }
      this.handleFilter();
    },
    resetTemp() {
      this.temp = {
        id: undefined,
        importance: 1,
        remark: "",
        timestamp: new Date(),
        title: "",
        status: "published",
        type: "",
      };
    },
    handleCreate() {
      this.resetTemp();
      this.dialogStatus = "create";
      this.dialogFormVisible = true;
      this.$nextTick(() => {
        this.$refs["dataForm"].clearValidate();
      });
    },
    createData() {
      this.$refs["dataForm"].validate((valid) => {
        if (valid) {
          addCar(this.temp).then(() => {
     //       this.getList();
            this.dialogFormVisible = false;
            this.$notify({
              title: "Success",
              message: "Created Successfully",
              type: "success",
              duration: 2000,
            });
          });
        }
      });
    },

    updateData() {
      this.$refs["dataForm"].validate((valid) => {
        if (valid) {
          updateCar(this.temp).then(() => {
        //    this.getList();
            this.dialogFormVisible = false;
            this.$notify({
              title: "Success",
              message: "Update Successfully",
              type: "success",
              duration: 2000,
            });
          });
        }
      });
    },
    handleDelete(row, index) {
      this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      }).then(() => {
        deleteCar({ id: row.id }).then(() => {
     //     this.getList();
          this.dialogFormVisible = false;
          this.$notify({
            title: "Success",
            message: "Delete Successfully",
            type: "success",
            duration: 2000,
          });
        });
      });
    },
    handleFetchPv(pv) {
      fetchPv(pv).then((response) => {
        this.pvData = response.data.pvData;
        this.dialogPvVisible = true;
      });
    },
    handleDownload() {
      axios({
        method: "GET",
        url: "/car/export",
        params: this.listQuery,
        headers: { pacargle: getToken() },
        responseType: "blob", //返回是个文件
      }).then((response) => {
        this.download(response); //then直接下载，方法在下边
      });
    },
    download(res) {
      let blob = new Blob([res.data], { type: "text/xls,charset=UTF-8" }); //type是文件类，详情可以参阅blob文件类型
      // 创建新的URL并指向File对象或者Blob对象的地址
      const blobURL = window.URL.createObjectURL(blob);
      // 创建a标签，用于跳转至下载链接
      const tempLink = document.createElement("a");
      tempLink.style.display = "none";
      tempLink.href = blobURL;
      tempLink.setAttribute(
        "download",
        decodeURI(
          res.headers["content-disposition"].split(";")[1].split("=")[1]
        )
      );
      // 兼容：某些浏览器不支持HTML5的download属性
      if (typeof tempLink.download === "undefined") {
        tempLink.setAttribute("target", "_blank");
      }
      // 挂载a标签
      document.body.appendChild(tempLink);
      tempLink.click();
      document.body.removeChild(tempLink);
      // 释放blob URL地址
      window.URL.revokeObjectURL(blobURL);
    },
    formatJson(filterVal) {
      return this.list.map((v) =>
        filterVal.map((j) => {
          if (j === "timestamp") {
            return parseTime(v[j]);
          } else {
            return v[j];
          }
        })
      );
    },
    getSortClass: function (key) {
      const sort = this.listQuery.sort;
      return sort === `+${key}` ? "ascending" : "descending";
    },

   judgeElectricFee(value){
    let _this = this;
    if(value == 3){
      _this.feeForm.electricFee_selected = _this.feeForm.electricFee1;
      return(parseFloat(_this.feeForm.electricFee_selected));
    }else if(value == 2){
      _this.feeForm.electricFee_selected = _this.feeForm.electricFee2;
      return(parseFloat(_this.feeForm.electricFee_selected));
    }else if(value == 1){
      _this.feeForm.electricFee_selected = _this.feeForm.electricFee3;
      return(parseFloat(_this.feeForm.electricFee_selected));
    }else if(value == 0){
      _this.feeForm.electricFee_selected = _this.feeForm.electricFee4;
      return(parseFloat(_this.feeForm.electricFee_selected));
    }else{
      return('');
    }
   },

   setParam (row) {
 
    var _this = this;

    let data;

    data = {
  
      id: this.formParam.id,
      remark: this.formParam.unicode

    },

    console.log(data);

      setParamBylockApi(data).then(
            function (resp) {
              
              if (resp.errmsg === "ok") {
          
                _this.$notify({
                  title: "成功",
                  message: "参数修改成功",
                  type: "success"
                });
                _this.editParamDialog = false
              } 
            }
          ).catch(
            function (resp) {
               
                _this.$notify({
                  title: "失败",
                  message: "参数修改失败，请稍后重试。",
                  type: "error"
                });
              }
           
          )  

   },

  
    batchChangePriceSubmit (row) {
     

      let _this = this;

      _this.electricList=[];
      _this.electricList2=[];
      _this.$refs.feeForm.validate((valid) => {
        if (valid) {
          let data;
          if(!_this.timeSharing){
            data = {
              remark:_this.remark,
              freeTime: _this.feeForm.freeTime,
              occupiedFee: parseFloat(_this.feeForm.occupiedFee),
              occupiedUnit: parseFloat(_this.feeForm.occupiedUnit),
              electricFee: parseFloat(_this.feeForm.electricFee),
              oriFee: parseFloat(_this.feeForm.oriFee),
              // serviceFee: parseFloat(_this.feeForm.serviceFee),
            }
          }else{


            let interval1='0' + ';' + _this.electric.electric1 + ';' + _this.feeForm.startTime1 + '-' + _this.feeForm.startTime2 + ';' + _this.judgeElectricFee(_this.electric.electric1);
            let interval2='1' + ';' + _this.electric.electric2 + ';' + _this.feeForm.startTime2 + '-' + _this.feeForm.startTime3 + ';' + _this.judgeElectricFee(_this.electric.electric2);
             let interval3='2' + ';' + _this.electric.electric3 + ';' + _this.feeForm.startTime3 + '-' + _this.feeForm.startTime4 + ';' + _this.judgeElectricFee(_this.electric.electric3);
             let interval4='3' + ';' + _this.electric.electric4 + ';' + _this.feeForm.startTime4 + '-' + _this.feeForm.startTime5 + ';' + _this.judgeElectricFee(_this.electric.electric4);
             let interval5='4' + ';' + _this.electric.electric5 + ';' + _this.feeForm.startTime5 + '-' + _this.feeForm.startTime6 + ';' + _this.judgeElectricFee(_this.electric.electric5);
             let interval6='5' + ';' + _this.electric.electric6 + ';' + _this.feeForm.startTime6 + '-' + _this.feeForm.startTime7 + ';' + _this.judgeElectricFee(_this.electric.electric6);
             let interval7='6' + ';' + _this.electric.electric7 + ';' + _this.feeForm.startTime7 + '-' + _this.feeForm.startTime8 + ';' + _this.judgeElectricFee(_this.electric.electric7);
             let interval8='7' + ';' + _this.electric.electric8 + ';' + _this.feeForm.startTime8 + '-' + _this.feeForm.startTime9 + ';' + _this.judgeElectricFee(_this.electric.electric8);
             let interval9='8' + ';' + _this.electric.electric9 + ';' + _this.feeForm.startTime9 + '-' + _this.feeForm.startTime10 + ';' + _this.judgeElectricFee(_this.electric.electric9);
             let interval10='9' + ';' + _this.electric.electric10 + ';' + _this.feeForm.startTime10 + '-' + _this.feeForm.startTime11 + ';' + _this.judgeElectricFee(_this.electric.electric10);
             let interval11='10' + ';' + _this.electric.electric11 + ';' + _this.feeForm.startTime11 + '-' + _this.feeForm.startTime12 + ';' + _this.judgeElectricFee(_this.electric.electric11);
             let interval12='11' + ';' + _this.electric.electric12 + ';' + _this.feeForm.startTime12 + '-' + _this.feeForm.startTime13 + ';' + _this.judgeElectricFee(_this.electric.electric12);
             let interval13='12' + ';' + _this.electric.electric13 + ';' + _this.feeForm.startTime13 + '-' + _this.feeForm.startTime14 + ';' + _this.judgeElectricFee(_this.electric.electric13);
             let interval14='13' + ';' + _this.electric.electric14 + ';' + _this.feeForm.startTime14 + '-' + _this.feeForm.startTime15 + ';' + _this.judgeElectricFee(_this.electric.electric14);
             let interval15='14' + ';' + _this.electric.electric15 + ';' + _this.feeForm.startTime15 + '-' + _this.feeForm.startTime16 + ';' + _this.judgeElectricFee(_this.electric.electric15);
             let interval16='15' + ';' + _this.electric.electric16 + ';' + _this.feeForm.startTime16 + '-' + _this.feeForm.startTime17 + ';' + _this.judgeElectricFee(_this.electric.electric16);
             let interval17='16' + ';' + _this.electric.electric17 + ';' + _this.feeForm.startTime17 + '-' + _this.feeForm.startTime18 + ';' + _this.judgeElectricFee(_this.electric.electric17);
             let interval18='17' + ';' + _this.electric.electric18 + ';' + _this.feeForm.startTime18 + '-' + _this.feeForm.startTime19 + ';' + _this.judgeElectricFee(_this.electric.electric18);
             let interval19='18' + ';' + _this.electric.electric19 + ';' + _this.feeForm.startTime19 + '-' + _this.feeForm.startTime20 + ';' + _this.judgeElectricFee(_this.electric.electric19);
             let interval20='19' + ';' + _this.electric.electric20 + ';' + _this.feeForm.startTime20 + '-' + _this.feeForm.startTime21 + ';' + _this.judgeElectricFee(_this.electric.electric20);
             let interval21='20' + ';' + _this.electric.electric21 + ';' + _this.feeForm.startTime21 + '-' + _this.feeForm.startTime22 + ';' + _this.judgeElectricFee(_this.electric.electric21);
             let interval22='21' + ';' + _this.electric.electric22 + ';' + _this.feeForm.startTime22 + '-' + _this.feeForm.startTime23 + ';' + _this.judgeElectricFee(_this.electric.electric22);
             let interval23='22' + ';' + _this.electric.electric23 + ';' + _this.feeForm.startTime23 + '-' + _this.feeForm.startTime24 + ';' + _this.judgeElectricFee(_this.electric.electric23);
             let interval24='23' + ';' + _this.electric.electric24 + ';' + _this.feeForm.startTime24 + '-' + _this.feeForm.startTime25 + ';' + _this.judgeElectricFee(_this.electric.electric24);
             _this.electricList.push(interval1);
             _this.electricList.push(interval2);
             _this.electricList.push(interval3);
             _this.electricList.push(interval4);
             _this.electricList.push(interval5);
             _this.electricList.push(interval6);
             _this.electricList.push(interval7);
             _this.electricList.push(interval8);
             _this.electricList.push(interval9);
             _this.electricList.push(interval10);
             _this.electricList.push(interval11);
             _this.electricList.push(interval12);
             _this.electricList.push(interval13);
             _this.electricList.push(interval14);
             _this.electricList.push(interval15);
             _this.electricList.push(interval16);
             _this.electricList.push(interval17);
             _this.electricList.push(interval18);
             _this.electricList.push(interval19);
             _this.electricList.push(interval20);
             _this.electricList.push(interval21);
             _this.electricList.push(interval22);
             _this.electricList.push(interval23);
             _this.electricList.push(interval24);

             _this.electricList2.push(_this.electric.electric1);
             _this.electricList2.push(_this.electric.electric2);
             _this.electricList2.push(_this.electric.electric3);
             _this.electricList2.push(_this.electric.electric4);
             _this.electricList2.push(_this.electric.electric5);
             _this.electricList2.push(_this.electric.electric6);
             _this.electricList2.push(_this.electric.electric7);
             _this.electricList2.push(_this.electric.electric8);
             _this.electricList2.push(_this.electric.electric9);
             _this.electricList2.push(_this.electric.electric10);
             _this.electricList2.push(_this.electric.electric11);
             _this.electricList2.push(_this.electric.electric12);
             _this.electricList2.push(_this.electric.electric13);
             _this.electricList2.push(_this.electric.electric14);
             _this.electricList2.push(_this.electric.electric15);
             _this.electricList2.push(_this.electric.electric16);
             _this.electricList2.push(_this.electric.electric17);
             _this.electricList2.push(_this.electric.electric18);
             _this.electricList2.push(_this.electric.electric19);
             _this.electricList2.push(_this.electric.electric20);
             _this.electricList2.push(_this.electric.electric21);
             _this.electricList2.push(_this.electric.electric22);
             _this.electricList2.push(_this.electric.electric23);
             _this.electricList2.push(_this.electric.electric24);



            data = {
              
              freeTime: _this.feeForm.freeTime,
              occupiedUnit: parseFloat(_this.feeForm.occupiedUnit),
              occupiedFee: parseFloat(_this.feeForm.occupiedFee),
              oriFee: parseFloat(_this.feeForm.oriFee),
              // serviceFee: parseFloat(_this.feeForm.serviceFee),
              remark:_this.remark,


              electricList:_this.electricList,

              // interval1:_this.electric.electric1 + ';' + _this.feeForm.startTime1 + '-' + _this.feeForm.startTime2 + ';' + _this.judgeElectricFee(_this.electric.electric1),
              // interval2:_this.electric.electric2 + ';' + _this.feeForm.startTime2 + '-' + _this.feeForm.startTime3 + ';' + _this.judgeElectricFee(_this.electric.electric2),
              // interval3:_this.electric.electric3 + ';' + _this.feeForm.startTime3 + '-' + _this.feeForm.startTime4 + ';' + _this.judgeElectricFee(_this.electric.electric3),
              // interval4:_this.electric.electric4 + ';' + _this.feeForm.startTime4 + '-' + _this.feeForm.startTime5 + ';' + _this.judgeElectricFee(_this.electric.electric4),
              // interval5:_this.electric.electric5 + ';' + _this.feeForm.startTime5 + '-' + _this.feeForm.startTime6 + ';' + _this.judgeElectricFee(_this.electric.electric5),
              // interval6:_this.electric.electric6 + ';' + _this.feeForm.startTime6 + '-' + _this.feeForm.startTime7 + ';' + _this.judgeElectricFee(_this.electric.electric6),
              // interval7:_this.electric.electric7 + ';' + _this.feeForm.startTime7 + '-' + _this.feeForm.startTime8 + ';' + _this.judgeElectricFee(_this.electric.electric7),
              // interval8:_this.electric.electric8 + ';' + _this.feeForm.startTime8 + '-' + _this.feeForm.startTime9 + ';' + _this.judgeElectricFee(_this.electric.electric8),
              // interval9:_this.electric.electric9 + ';' + _this.feeForm.startTime9 + '-' + _this.feeForm.startTime10 + ';' + _this.judgeElectricFee(_this.electric.electric9),
              // interval10:_this.electric.electric10 + ';' + _this.feeForm.startTime10 + '-' + _this.feeForm.startTime11 + ';' + _this.judgeElectricFee(_this.electric.electric10),
              // interval11:_this.electric.electric11 + ';' + _this.feeForm.startTime11 + '-' + _this.feeForm.startTime12 + ';' + _this.judgeElectricFee(_this.electric.electric11),
              // interval12:_this.electric.electric12 + ';' + _this.feeForm.startTime12 + '-' + _this.feeForm.startTime13 + ';' + _this.judgeElectricFee(_this.electric.electric12),
              // interval13:_this.electric.electric13 + ';' + _this.feeForm.startTime13 + '-' + _this.feeForm.startTime14 + ';' + _this.judgeElectricFee(_this.electric.electric13),
              // interval14:_this.electric.electric14 + ';' + _this.feeForm.startTime14 + '-' + _this.feeForm.startTime15 + ';' + _this.judgeElectricFee(_this.electric.electric14),
              // interval15:_this.electric.electric15 + ';' + _this.feeForm.startTime15 + '-' + _this.feeForm.startTime16 + ';' + _this.judgeElectricFee(_this.electric.electric15),
              // interval16:_this.electric.electric16 + ';' + _this.feeForm.startTime16 + '-' + _this.feeForm.startTime17 + ';' + _this.judgeElectricFee(_this.electric.electric16),
              // interval17:_this.electric.electric17 + ';' + _this.feeForm.startTime17 + '-' + _this.feeForm.startTime18 + ';' + _this.judgeElectricFee(_this.electric.electric17),
              // interval18:_this.electric.electric18 + ';' + _this.feeForm.startTime18 + '-' + _this.feeForm.startTime19 + ';' + _this.judgeElectricFee(_this.electric.electric18),
              // interval19:_this.electric.electric19 + ';' + _this.feeForm.startTime19 + '-' + _this.feeForm.startTime20 + ';' + _this.judgeElectricFee(_this.electric.electric19),
              // interval20:_this.electric.electric20 + ';' + _this.feeForm.startTime20 + '-' + _this.feeForm.startTime21 + ';' + _this.judgeElectricFee(_this.electric.electric20),
              // interval21:_this.electric.electric21 + ';' + _this.feeForm.startTime21 + '-' + _this.feeForm.startTime22 + ';' + _this.judgeElectricFee(_this.electric.electric21),
              // interval22:_this.electric.electric22 + ';' + _this.feeForm.startTime22 + '-' + _this.feeForm.startTime23 + ';' + _this.judgeElectricFee(_this.electric.electric22),
              // interval23:_this.electric.electric23 + ';' + _this.feeForm.startTime23 + '-' + _this.feeForm.startTime24 + ';' + _this.judgeElectricFee(_this.electric.electric23),
              // interval24:_this.electric.electric24 + ';' + _this.feeForm.startTime24 + '-' + _this.feeForm.startTime1 + ';' + _this.judgeElectricFee(_this.electric.electric24),
              electricFee1: parseFloat(_this.feeForm.electricFee1),
              electricFee2: parseFloat(_this.feeForm.electricFee2),
              electricFee3: parseFloat(_this.feeForm.electricFee3),
              electricFee4: parseFloat(_this.feeForm.electricFee4),

              serviceFee1: parseFloat(_this.feeForm.serviceFee1),
              serviceFee2: parseFloat(_this.feeForm.serviceFee2),
              serviceFee3: parseFloat(_this.feeForm.serviceFee3),
              serviceFee4: parseFloat(_this.feeForm.serviceFee4),

            };
          };

          if(_this.timeSharing){

          if(_this.electricList2.indexOf("0") === -1){
            alert("至少设置一个时段包含“尖”!");
          }else if(_this.electricList2.indexOf("1") === -1){
            alert("至少设置一个时段包含“峰”!");
          }else if(_this.electricList2.indexOf("2") === -1){
            alert("至少设置一个时段包含“平”!");
          }else if(_this.electricList2.indexOf("3") === -1){
            alert("至少设置一个时段包含“谷”!");
          }

          _this.loading=true;
            setPriceBylockApi(data).then(
            function (resp) {
              _this.remark='';
             
              if (resp.errmsg === "ok") {
                _this.loading=false;
                _this.$notify({
                  title: "成功",
                  message: "价格修改成功",
                  type: "success"
                });
                _this.editFeeDialog = false
              }else if(resp.errmsg === "charger.price.set"){
                console.log("111");
                _this.$notify({
                  title: "失败",
                  message: "价格修改失败，请稍后重试。",
                  type: "error"
                });
              }
            }
          ).catch(
            function (resp) {
              
               if(resp.errmsg === "charger.price.set"){
                console.log("333");
                _this.$notify({
                  title: "失败",
                  message: "价格修改失败，请稍后重试。",
                  type: "error"
                });
              }
            }
           
          )  


          }else{
          
          setPriceBylockApi(data).then(
            function (resp) {
              _this.remark='';
              if (resp.errmsg === "ok") {
                console.log("222");
                _this.$notify({
                  title: "成功",
                  message: "价格修改成功",
                  type: "success"
                });
                _this.editFeeDialog = false
              }else if(resp.errmsg === "charger.price.set"){
                console.log("111");
                _this.$notify({
                  title: "失败",
                  message: "价格修改失败，请稍后重试。",
                  type: "error"
                });
              }
            }
          ).catch(
            function (resp) {
              
               if(resp.errmsg === "charger.price.set"){
                console.log("333");
                _this.$notify({
                  title: "失败",
                  message: "价格修改失败，请稍后重试。",
                  type: "error"
                });
              }
            }
           
          )  
          }  
        }
      });
    },

    compareDate(t1,t2){//两个时间相等
      var date = new Date();
      var a = t1.split(":");
      var b = t2.split(":");
      return date.setHours(a[0],a[1]) == date.setHours(b[0],b[1]);
    },
        compareDate1(t1,t2){//t1大于t2
      var date = new Date();
      var a = t1.split(":");
      var b = t2.split(":");
      return date.setHours(a[0],a[1]) > date.setHours(b[0],b[1]);
    },


        judgeTime1(startTime1, endTime1, startTime2, endTime2){
      let _this = this;
      if(_this.compareDate1(endTime2,startTime2)){
        if(_this.compareDate1(startTime1,startTime2) && _this.compareDate1(endTime2,startTime1)){
          return false;
        }
        if(_this.compareDate1(endTime1,startTime2) && _this.compareDate1(endTime2,endTime1)){
          return false;
        }
        if(_this.compareDate1(endTime1,endTime2) && _this.compareDate1(startTime2,startTime1)){
          return false;
        }
        if(_this.compareDate1(endTime2,endTime1) && _this.compareDate1(startTime1,startTime2)){
          return false;
        }
      }
      if(_this.compareDate1(startTime2,endTime2)){
        if(_this.compareDate1(startTime1,startTime2)){
          return false;
        }
        if(_this.compareDate1(endTime1,startTime2)){
          return false;
        }
        if(_this.compareDate1(startTime1,startTime2) && _this.compareDate1(endTime2,startTime1)){
          return false;
        }
        if(_this.compareDate1(startTime2,startTime1) && _this.compareDate1(endTime1,endTime2)){
          return false;
        }
      }
      if(_this.compareDate1(endTime1,startTime1)){
        if(_this.compareDate1(startTime2,startTime1) && _this.compareDate1(endTime1,startTime2)){
          return false;
        }
        if(_this.compareDate1(endTime2,startTime1) && _this.compareDate1(endTime1,endTime2)){
          return false;
        }
        if(_this.compareDate1(endTime2,endTime1) && _this.compareDate1(startTime1,startTime2)){
          return false;
        }
        if(_this.compareDate1(endTime1,endTime2) && _this.compareDate1(startTime2,startTime1)){
          return false;
        }
      }
      if(_this.compareDate1(startTime1,endTime1)){
        if(_this.compareDate1(startTime2,startTime1)){
          return false;
        }
        if(_this.compareDate1(endTime2,startTime1)){
          return false;
        }
        if(_this.compareDate1(startTime2,startTime1) && _this.compareDate1(endTime1,startTime2)){
          return false;
        }
        if(_this.compareDate1(startTime1,startTime2) && _this.compareDate1(endTime2,endTime1)){
          return false;
        }
      }
      return true;
    },
    judgeTime(){//判断设置时间断总和是否等于24小时
      let _this = this;
   //   console.log(_this.feeForm)
      var endTime1 = _this.feeForm.endTime1 === '24:00' ? '00:00' : _this.feeForm.endTime1
      var endTime2 = _this.feeForm.endTime2 === '24:00' ? '00:00' : _this.feeForm.endTime2
      var endTime3 = _this.feeForm.endTime3 === '24:00' ? '00:00' : _this.feeForm.endTime3
      var endTime4 = _this.feeForm.endTime4 === '24:00' ? '00:00' : _this.feeForm.endTime4
      
      if(_this.compareDate(_this.feeForm.startTime1,endTime2)){
        if(_this.compareDate(_this.feeForm.startTime2,endTime1)){
          if(_this.compareDate(_this.feeForm.startTime3,endTime4)){
            if(_this.compareDate(_this.feeForm.startTime4,endTime3)){
              return true;
            }
          }
        }
        if(_this.compareDate(_this.feeForm.startTime2,endTime3)){
          if(_this.compareDate(_this.feeForm.startTime3,endTime4)){
            if(_this.compareDate(_this.feeForm.startTime4,endTime1)){
              return true;
            }
          }
        }
        if(_this.compareDate(_this.feeForm.startTime2,endTime4)){
          if(_this.compareDate(_this.feeForm.startTime3,endTime1)){
            if(_this.compareDate(_this.feeForm.startTime4,endTime3)){
              return true;
            }
          }
        }
      }

      if(_this.compareDate(_this.feeForm.startTime1,endTime3)){
        if(_this.compareDate(_this.feeForm.startTime2,endTime1)){
          if(_this.compareDate(_this.feeForm.startTime3,endTime4)){
            if(_this.compareDate(_this.feeForm.startTime4,endTime2)){
              return true;
            }
          }
        }
        if(_this.compareDate(_this.feeForm.startTime2,endTime1)){
          if(_this.compareDate(_this.feeForm.startTime3,endTime4)){
            if(_this.compareDate(_this.feeForm.startTime4,endTime3)){
              return true;
            }
          }
        }
        if(_this.compareDate(_this.feeForm.startTime2,_this.feeForm.endTime4)){
          if(_this.compareDate(_this.feeForm.startTime3,_this.feeForm.endTime1)){
            if(_this.compareDate(_this.feeForm.startTime4,_this.feeForm.endTime2)){
              return true;
            }
          }
          if(_this.compareDate(_this.feeForm.startTime3,_this.feeForm.endTime2)){
            if(_this.compareDate(_this.feeForm.startTime4,_this.feeForm.endTime1)){
              return true;
            }
          }
        }
      }

      if(_this.compareDate(_this.feeForm.startTime1,endTime4)){
        if(_this.compareDate(_this.feeForm.startTime2,endTime1)){
          if(_this.compareDate(_this.feeForm.startTime3,endTime2)){
            if(_this.compareDate(_this.feeForm.startTime4,endTime3)){
              return true;
            }
          }
        }
        if(_this.compareDate(_this.feeForm.startTime2,endTime3)){
          if(_this.compareDate(_this.feeForm.startTime3,endTime1)){
            if(_this.compareDate(_this.feeForm.startTime4,endTime2)){
              return true;
            }
          }
          if(_this.compareDate(_this.feeForm.startTime3,endTime2)){
            if(_this.compareDate(_this.feeForm.startTime4,endTime1)){
              return true;
            }
          }
        }
        if(_this.compareDate(_this.feeForm.startTime2,endTime1)){
          if(_this.compareDate(_this.feeForm.startTime3,endTime2)){
            if(_this.compareDate(_this.feeForm.startTime4,endTime3)){
              return true;
            }
          }
        }
      }
      
      return false;
    },


      sub(value) {
      if (value === null || undefined) {
        return "";
      } else {
        value = value.toString().substring(0, 5);
        return value;
      }
    },

    getParam(row) {

      var _this=this;
      this.editParamDialog=true;
      this.formParam.unicode= row.unicode;
      this.formParam.id= row.lockId;

      console.log(this.formParam);

    },

    handleUpdate(row) {
      var _this=this;
      this.timeSharing=true;
      this.temp = Object.assign({}, row); // copy obj
      this.temp.timestamp = new Date(this.temp.timestamp);
      this.dialogStatus = "update";
      this.editFeeDialog = true;
      this.feeForm.electricFee1='255';
      this.feeForm.electricFee2='255';
      this.feeForm.electricFee3='255';
      this.feeForm.electricFee4='255';

                 _this.electric.electric1="2";
                   _this.electric.electric2="2";
                    _this.electric.electric3="2";
                     _this.electric.electric4="2";
                      _this.electric.electric5="2";
                       _this.electric.electric6="2";
                        _this.electric.electric7="2";
                         _this.electric.electric8="2";
                          _this.electric.electric9="2";
                           _this.electric.electric10="2";
                            _this.electric.electric10="2";
                             _this.electric.electric12="2";
                              _this.electric.electric13="2";
                               _this.electric.electric14="2";
                                _this.electric.electric15="2";
                                 _this.electric.electric16="2";
                                  _this.electric.electric17="2";
                                   _this.electric.electric18="2";
                                    _this.electric.electric19="2";
                                     _this.electric.electric20="2";
                                      _this.electric.electric21="2";
                                       _this.electric.electric22="2";
                                        _this.electric.electric23="2";
                                         _this.electric.electric24="2";

      // this.$nextTick(() => {
      //   this.$refs["dataForm"].clearValidate();
      // });
   //   var mac = this.row.lockMac;
      
      const mac = row.lockMac;
      _this.remark= row.lockMac;

      getPriceBylockApi({
        mac:mac
      }).then((response) => {
  //      console.log(response.data);

 
      _this.feeForm.freeTime=response.data.freeTime;
      _this.feeForm.occupiedUnit=response.data.occupiedUnit;
      _this.feeForm.occupiedFee=response.data.occupiedFee;
      _this.feeForm.freeTelectricFee=response.data.electricFee;
      _this.feeForm.oriFee=response.data.oriFee;
      _this.feeForm.serviceFee=response.data.serviceFee;
      // _this.feeForm.startTime1=response.data.interval1.toString().substring(0, 5);
      // _this.feeForm.endTime1=response.data.interval1.toString().substring(6,11);
      _this.feeForm.electricFee1=response.data.electricFee1;
      _this.electric.electric1=response.data.electricList[0];
      _this.electric.electric2=response.data.electricList[1];
      _this.electric.electric3=response.data.electricList[2];
      _this.electric.electric4=response.data.electricList[3];
      _this.electric.electric5=response.data.electricList[4];
      _this.electric.electric6=response.data.electricList[5];
      _this.electric.electric7=response.data.electricList[6];
      _this.electric.electric8=response.data.electricList[7];
      _this.electric.electric9=response.data.electricList[8];
      _this.electric.electric10=response.data.electricList[9];
      _this.electric.electric11=response.data.electricList[10];
      _this.electric.electric12=response.data.electricList[11];
      _this.electric.electric13=response.data.electricList[12];
      _this.electric.electric14=response.data.electricList[13];
      _this.electric.electric15=response.data.electricList[14];
      _this.electric.electric16=response.data.electricList[15];
      _this.electric.electric17=response.data.electricList[16];
      _this.electric.electric18=response.data.electricList[17];
      _this.electric.electric19=response.data.electricList[18];
      _this.electric.electric20=response.data.electricList[19];
      _this.electric.electric21=response.data.electricList[20];
      _this.electric.electric22=response.data.electricList[21];
      _this.electric.electric23=response.data.electricList[22];
      _this.electric.electric24=response.data.electricList[23];
      // _this.feeForm.startTime2=response.data.interval2.toString().substring(0, 5);
      // _this.feeForm.endTime2=response.data.interval2.toString().substring(6,11);
      _this.feeForm.electricFee1=response.data.electricFee1
      _this.feeForm.electricFee2=response.data.electricFee2
      // _this.feeForm.startTime3=response.data.interval3.toString().substring(0, 5);
      // _this.feeForm.endTime3=response.data.interval3.toString().substring(6,11);
      _this.feeForm.electricFee3=response.data.electricFee3;
      // _this.feeForm.startTime4=response.data.interval4.toString().substring(0, 5);
      // _this.feeForm.endTime4=response.data.interval4.toString().substring(6,11);
      _this.feeForm.electricFee4=response.data.electricFee4

      if(response.data.serviceFee1 == '' || response.data.serviceFee1 == null){
        _this.feeForm.serviceFee1 = 0
      }else{
        _this.feeForm.serviceFee1=response.data.serviceFee1
      }
      if(response.data.serviceFee2 == '' || response.data.serviceFee2 == null){
        _this.feeForm.serviceFee2 = 0
      }else{
        _this.feeForm.serviceFee2=response.data.serviceFee2
      }
      if(response.data.serviceFee3 == '' || response.data.serviceFee3 == null){
        _this.feeForm.serviceFee3 = 0
      }else{
        _this.feeForm.serviceFee3=response.data.serviceFee3
      }
      if(response.data.serviceFee4 == '' || response.data.serviceFee4 == null){
        _this.feeForm.serviceFee4 = 0
      }else{
        _this.feeForm.serviceFee4=response.data.serviceFee4
      }
 
      _this.feeForm.electric1 = Number(_this.feeForm.electricFee1) - Number(_this.feeForm.serviceFee1)
      _this.feeForm.electric2 = Number(_this.feeForm.electricFee2) - Number(_this.feeForm.serviceFee2)
      _this.feeForm.electric3 = Number(_this.feeForm.electricFee3) - Number(_this.feeForm.serviceFee3)
      _this.feeForm.electric4 = Number(_this.feeForm.electricFee4) - Number(_this.feeForm.serviceFee4)



      _this.feeForm.interval1 = response.data.interval1
      _this.feeForm.interval2 = response.data.interval2
      _this.feeForm.interval3 = response.data.interval3
      _this.feeForm.interval4 = response.data.interval4



      // if(_this.feeForm.electricFee1 != null && _this.feeForm.electricFee1 != '' && _this.feeForm.serviceFee1 != null && _this.feeForm.serviceFee1 != ''){
      //   _this.feeForm.priceTotal1 = _this.feeForm.electricFee1 + _this.feeForm.serviceFee1
      // }
      // if(_this.feeForm.electricFee2 != null && _this.feeForm.electricFee2 != '' && _this.feeForm.serviceFee2 != null && _this.feeForm.serviceFee2 != ''){
      //   _this.feeForm.priceTotal2 = _this.feeForm.electricFee2 + _this.feeForm.serviceFee2
      // }
      // if(_this.feeForm.electricFee3 != null && _this.feeForm.electricFee3 != '' && _this.feeForm.serviceFee3 != null && _this.feeForm.serviceFee3 != ''){
      //   _this.feeForm.priceTotal3 = _this.feeForm.electricFee3 + _this.feeForm.serviceFee3
      // }
      // if(_this.feeForm.electricFee4 != null && _this.feeForm.electricFee4 != '' && _this.feeForm.serviceFee4 != null && _this.feeForm.serviceFee4 != ''){
      //   _this.feeForm.priceTotal4 = _this.feeForm.electricFee4 + _this.feeForm.serviceFee4
      // }

      setTimeout(() => {
          _this.listLoading = false;
        }, 1 * 1000);
      });
    },
   addPrice11(){
      var _this = this;
      _this.feeForm.electric1 = _this.feeForm.electric1.replace(/[^\d.]/g, "");
      if(_this.feeForm.electric1 == null || _this.feeForm.electric1 == ''){
        _this.feeForm.electric1 = 0
      }
      if(_this.feeForm.serviceFee1 == null || _this.feeForm.serviceFee1 == ''){
        _this.feeForm.serviceFee1 = 0
      }
        _this.feeForm.electricFee1 = Number(_this.feeForm.electric1) + Number(_this.feeForm.serviceFee1)
        _this.feeForm.electricFee1 = _this.feeForm.electricFee1.toFixed(3)
 
    },
    addPrice12(){
      var _this = this;
      _this.feeForm.serviceFee1 = _this.feeForm.serviceFee1.replace(/[^\d.]/g, "");
      if(_this.feeForm.electric1 == null || _this.feeForm.electric1 == ''){
        _this.feeForm.electric1 = 0
      }
      if(_this.feeForm.serviceFee1 == null || _this.feeForm.serviceFee1 == ''){
        _this.feeForm.serviceFee1 = 0
      }
      _this.feeForm.electricFee1 = Number(_this.feeForm.electric1) + Number(_this.feeForm.serviceFee1)
        _this.feeForm.electricFee1 = _this.feeForm.electricFee1.toFixed(3)
    },

    addPrice21(){
      var _this = this;
      _this.feeForm.electric2 = _this.feeForm.electric2.replace(/[^\d.]/g, "");
      if(_this.feeForm.electric2 == null || _this.feeForm.electric2 == ''){
        _this.feeForm.electric2 = 0
      }
      if(_this.feeForm.serviceFee2 == null || _this.feeForm.serviceFee2 == ''){
        _this.feeForm.serviceFee2 = 0
      }
        _this.feeForm.electricFee2 = Number(_this.feeForm.electric2) + Number(_this.feeForm.serviceFee2)
        _this.feeForm.electricFee2 = _this.feeForm.electricFee2.toFixed(3)
 
    },
    addPrice22(){
      var _this = this;
      _this.feeForm.serviceFee2 = _this.feeForm.serviceFee2.replace(/[^\d.]/g, "");
      if(_this.feeForm.electric2 == null || _this.feeForm.electric2 == ''){
        _this.feeForm.electric2 = 0
      }
      if(_this.feeForm.serviceFee2 == null || _this.feeForm.serviceFee2 == ''){
        _this.feeForm.serviceFee2 = 0
      }
      _this.feeForm.electricFee2 = Number(_this.feeForm.electric2) + Number(_this.feeForm.serviceFee2)
        _this.feeForm.electricFee2 = _this.feeForm.electricFee2.toFixed(3)
    },

    addPrice31(){
      var _this = this;
      _this.feeForm.electric3 = _this.feeForm.electric3.replace(/[^\d.]/g, "");
      if(_this.feeForm.electric3 == null || _this.feeForm.electric3 == ''){
        _this.feeForm.electric3 = 0
      }
      if(_this.feeForm.serviceFee3 == null || _this.feeForm.serviceFee3 == ''){
        _this.feeForm.serviceFee3 = 0
      }
        _this.feeForm.electricFee3 = Number(_this.feeForm.electric3) + Number(_this.feeForm.serviceFee3)
        _this.feeForm.electricFee3 = _this.feeForm.electricFee3.toFixed(3)
 
    },
    addPrice32(){
      var _this = this;
      _this.feeForm.serviceFee3 = _this.feeForm.serviceFee3.replace(/[^\d.]/g, "");
      if(_this.feeForm.electric3 == null || _this.feeForm.electric3 == ''){
        _this.feeForm.electric3 = 0
      }
      if(_this.feeForm.serviceFee3 == null || _this.feeForm.serviceFee3 == ''){
        _this.feeForm.serviceFee3 = 0
      }
      _this.feeForm.electricFee3 = Number(_this.feeForm.electric3) + Number(_this.feeForm.serviceFee3)
        _this.feeForm.electricFee3 = _this.feeForm.electricFee3.toFixed(3)
    },

    addPrice41(){
      var _this = this;
      _this.feeForm.electric4 = _this.feeForm.electric4.replace(/[^\d.]/g, "");
      if(_this.feeForm.electric4 == null || _this.feeForm.electric4 == ''){
        _this.feeForm.electric4 = 0
      }
      if(_this.feeForm.serviceFee4 == null || _this.feeForm.serviceFee4 == ''){
        _this.feeForm.serviceFee4 = 0
      }
        _this.feeForm.electricFee4 = Number(_this.feeForm.electric4) + Number(_this.feeForm.serviceFee4)
        _this.feeForm.electricFee4 = _this.feeForm.electricFee4.toFixed(3)
 
    },
    addPrice42(){
      var _this = this;
      _this.feeForm.serviceFee4 = _this.feeForm.serviceFee4.replace(/[^\d.]/g, "");
      if(_this.feeForm.electric4 == null || _this.feeForm.electric4 == ''){
        _this.feeForm.electric4 = 0
      }
      if(_this.feeForm.serviceFee4 == null || _this.feeForm.serviceFee4 == ''){
        _this.feeForm.serviceFee4 = 0
      }
      _this.feeForm.electricFee4 = Number(_this.feeForm.electric4) + Number(_this.feeForm.serviceFee4)
        _this.feeForm.electricFee4 = _this.feeForm.electricFee4.toFixed(3)
    },
    


  },
};
</script>
